# 3-9 用Python实现队列
class Queue(object):
    def __init__(self):
        self.items = []

    def enqueue(self, item):
        self.items.insert(0, item)  # 代替 self.items.append(item)

    def dequeue(self):
        return self.items.pop()  # 代替 return self.items.pop(0)

    def isEmpty(self):
        return self.items == []

    def size(self):
        return len(self.items)


q = Queue()
q.enqueue(2)
q.enqueue(8)
print(q.items)  #[8, 2]
print(q.dequeue())  #2
print(q.isEmpty())  #False
print(q.size())     #1
